package org.expressme.employee.mgmt.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.expressme.employee.mgmt.Facade;

/**
 * Delete an employee.
 * 
 * @author Michael Liao (askxuefeng@gmail.com)
 */
public class DeleteServlet extends HttpServlet {

    private Facade facade;

    public void setFacade(Facade facade) {
        this.facade = facade;
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        facade.deleteEmployee(id);
        resp.sendRedirect("query");
    }

}
